import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-05-20
 * Time: 16:46
 */
public class test2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int T = in.nextInt();
        for (int k = 0; k < T; k++) {
            int n = in.nextInt();
            String s = in.next();
            int length = s.length();
            int[] ret = new int[length];
            // 记录0和1的个数
            int count0 = 0;
            int count1 = 0;
            for (int i = 0; i < length; i++) {
                char currentChar = s.charAt(i);
                if (currentChar == '0') {
                    // 数组添加1的个数
                    ret[i] = count1;
                    count0++;
                } else {
                    ret[i] = count0;
                    count1++;
                }
            }
            for (int j = 0; j < ret.length; j++) {
                System.out.print(ret[j]);
                System.out.print(" ");
            }
            System.out.println();
        }

    }
}
